////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file   CollabRCBot\PowerTreeNode.h
///
/// @brief  Declares an implementation of a CollabRC::Bot::OperationTreeNode
///         which handles the operation of raising to a power
////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once

#include "OperationTreeNode.h"

namespace CollabRC
{
    namespace Bot
    {
        namespace AI
        {
            /**
             * @brief Implementation of an OperationTreeNode which handles
             * raising a value to a power.
             *
             * This class may raise an IllegalOperationException if an
             * attempt is made to raise a negative value to a fractional exponent.
             * @version $Id$
             * @author Matthew P. Del Buono
             */
            class PowerTreeNode : public OperationTreeNode
            {
            private:
                class Factory : public OperationTreeNodeFactory
                {
                public:
                    ComputationalTreeNode* Instantiate(const ComputationalTreeNode& lhs, const ComputationalTreeNode& rhs) const;
                };

                static Factory factory;
            public:
                PowerTreeNode(const ComputationalTreeNode& lhs, const ComputationalTreeNode& rhs);
                PowerTreeNode(const OperationTreeNode& copy);
                virtual float PerformOperation(float lhs, float rhs) const;
                virtual ComputationalTreeNode* Clone() const;
                virtual ~PowerTreeNode(void);
                virtual void Accept(ComputationalTreeNodeVisitor& visitor);
            };
        }
    }
}
